<template>
  <div>
    <el-dialog title="复制商品信息" :visible.sync="log" width="700px">
      <div>
        <div style="height: 600px; overflow: auto;">
          <div class="flexc">
            <div class="flexc">
               <el-input v-model="sale_name" style="margin-right:20px;" placeholder="请输入商品名称"></el-input>
            </div>
            <div><el-button style="background:#3158F1;color:white" @click="getlist()" round>搜索</el-button></div>
          </div>
          <div class="flexbc" v-for="item in shoplists" :key="item.id" style="padding:10px 20px; margin-top:10px;">
            <div >
              <div style="margin-right: 20px;">
                <div style="margin-bottom: 10px; font-weight: bold;font-size:18px">{{item.sale_name}} </div>
              </div>
              <div class="flexc">
                <div style="margin-right: 20px;">
                  <div style="margin-bottom: 10px;">发布时间：{{item.created_at}} </div>
                </div>
                <div style="margin-right: 20px;">
                  <div style="margin-bottom: 10px;">修改时间：{{item.updated_at}} </div>
                </div>
              </div>

            </div>

            <div>
              <el-button style="background:#3158F1;color:white" @click="xuanzhong(item)" round >复制商品信息</el-button>
            </div>
          </div>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="log = false" style="border-radius:15px">取消</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>

  import axios from "axios";
  export default {
    name: 'mobanxuanze',
    data() {
      return {
        log:true,
        shoplists:"",
        sale_name:""
      }
    },
    created() {
      this.getlist()
    },
    methods:{
      getlist:function(){
        axios.get(`${this.apis}/api/page/all?sale_name=${this.sale_name}`)
          .then(response => {
            if(response.data.msg.code == 0){
              this.shoplists = response.data.data
            }else{
              this.$message.error(response.data.msg.info);
            }
          });
      },
      xuanzhong:function(item){
        this.$emit('fuzhishangpinxinxi2',item.id)
      }
    }
  }
</script>

<style lang="less" scoped>
  .xian{ padding: 30px; border: 3px solid rgb(186, 185, 185);}
  .act{ padding: 30px; border: 3px solid rgb(255, 1, 1) !important;}

  .act2{ background: rgb(233, 244, 255) !important; border: 1px solid rgb(0, 132, 255) !important; color: rgb(0, 126, 255) !important;}
</style>
